{
 "cells": [
  {
   "cell_type": "raw",
   "id": "51b8d0e7-cb68-403a-80b1-e56680cc97ab",
   "metadata": {},
   "source": [
    "测试模型参数读取"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "84a48bcc-4a59-425b-9504-b42424e36dd6",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mtrain_Lwf: \u001b[0mweights=./runs/train/fog_02/weights/best.pt, cfg=models/yolov5s_VOCKITTI.yaml, data=data/temp_test.yaml, hyp=data/hyps/hyp.scratch-low.yaml, epochs=50, batch_size=16, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, evolve_population=data/hyps, resume_evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=1, artifact_alias=latest, ndjson_console=False, ndjson_file=False, ewc_pt=None, ewc_lambda=0.0, SI_enable=False, SI_pt=None, SI_lambda=10.0, Lwf_enable=False, Lwf_lambda=0.01, Lwf_temperature=1.0\n",
      "Command 'git fetch ultralytics' timed out after 5 seconds\n",
      "YOLOv5 🚀 bda8da72 Python-3.10.8 torch-2.1.2+cu118 CUDA:0 (NVIDIA vGPU-32GB, 32260MiB)\n",
      "\n",
      "\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0\n",
      "\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/train', view at http://localhost:6006/\n",
      "\u001b[1;38;5;39mCOMET INFO:\u001b[0m Experiment is live on comet.com \u001b[38;5;39mhttps://www.comet.com/nagasaki-soyorin/yolov5/ddf32f1b437c41e185d4192d7d8ff9b6\u001b[0m\n",
      "\n",
      "\n",
      "                 from  n    params  module                                  arguments                     \n",
      "  0                -1  1      3520  models.common.Conv                      [3, 32, 6, 2, 2]              \n",
      "  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                \n",
      "  2                -1  1     18816  models.common.C3                        [64, 64, 1]                   \n",
      "  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               \n",
      "  4                -1  2    115712  models.common.C3                        [128, 128, 2]                 \n",
      "  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              \n",
      "  6                -1  3    625152  models.common.C3                        [256, 256, 3]                 \n",
      "  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              \n",
      "  8                -1  1   1182720  models.common.C3                        [512, 512, 1]                 \n",
      "  9                -1  1    656896  models.common.SPPF                      [512, 512, 5]                 \n",
      " 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              \n",
      " 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 12           [-1, 6]  1         0  models.common.Concat                    [1]                           \n",
      " 13                -1  1    361984  models.common.C3                        [512, 256, 1, False]          \n",
      " 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              \n",
      " 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 16           [-1, 4]  1         0  models.common.Concat                    [1]                           \n",
      " 17                -1  1     90880  models.common.C3                        [256, 128, 1, False]          \n",
      " 18                -1  1    147712  models.common.Conv                      [128, 128, 3, 2]              \n",
      " 19          [-1, 14]  1         0  models.common.Concat                    [1]                           \n",
      " 20                -1  1    296448  models.common.C3                        [256, 256, 1, False]          \n",
      " 21                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]              \n",
      " 22          [-1, 10]  1         0  models.common.Concat                    [1]                           \n",
      " 23                -1  1   1182720  models.common.C3                        [512, 512, 1, False]          \n",
      " 24      [17, 20, 23]  1     83607  models.yolo.Detect                      [26, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n",
      "YOLOv5s_VOCKITTI summary: 214 layers, 7089751 parameters, 7089751 gradients, 16.2 GFLOPs\n",
      "\n",
      "Transferred 342/349 items from runs/train/fog_02/weights/best.pt\n",
      "\u001b[34m\u001b[1mAMP: \u001b[0mchecks passed ✅\n",
      "\u001b[34m\u001b[1moptimizer:\u001b[0m SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 60 weight(decay=0.0005), 60 bias\n",
      "\u001b[34m\u001b[1malbumentations: \u001b[0m1 validation error for InitSchema\n",
      "size\n",
      "  Field required [type=missing, input_value={'height': 640, 'width': ...'mask_interpolation': 0}, input_type=dict]\n",
      "    For further information visit https://errors.pydantic.dev/2.10/v/missing\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mScanning /root/autodl-tmp/datasets/VOC/labels/train2007.cache... 2501 ima\u001b[0m\n",
      "\u001b[34m\u001b[1mval: \u001b[0mScanning /root/autodl-tmp/datasets/VOC/labels/val.cache... 1048 images, 0 b\u001b[0m\n",
      "\n",
      "\u001b[34m\u001b[1mAutoAnchor: \u001b[0m4.08 anchors/target, 1.000 Best Possible Recall (BPR). Current anchors are a good fit to dataset ✅\n",
      "Plotting labels to runs/train/exp32/labels.jpg... \n",
      "Image sizes 640 train, 640 val\n",
      "Using 8 dataloader workers\n",
      "Logging results to \u001b[1mruns/train/exp32\u001b[0m\n",
      "Starting training for 50 epochs...\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       0/49      3.64G    0.08259    0.04901     0.0735         32        640: 1\n",
      "tensor([0.94887], device='cuda:0', grad_fn=<MulBackward0>)  \n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       1048       5675     0.0467       0.17     0.0459      0.026\n",
      "\n",
      "      Epoch    GPU_mem   box_loss   obj_loss   cls_loss  Instances       Size\n",
      "       1/49      3.64G    0.06017    0.04287    0.05806         85        640:  fatal: unable to access 'https://github.com/ultralytics/yolov5/': Failed to connect to github.com port 443 after 129949 ms: Connection timed out\n",
      "       1/49      3.64G    0.05992    0.04252      0.058         14        640: 1\n",
      "tensor([0.50952], device='cuda:0', grad_fn=<MulBackward0>)  \n",
      "                 Class     Images  Instances          P          R      mAP50   "
     ]
    }
   ],
   "source": [
    "command = f\"\"\"\n",
    "env COMET_LOG_PER_CLASS_METRICS=true python train_Lwf.py \\\n",
    "--img 640 \\\n",
    "--bbox_interval 1 \\\n",
    "--cfg models/yolov5s_VOCKITTI.yaml \\\n",
    "--data data/temp_test.yaml \\\n",
    "--epochs 50 \\\n",
    "--weights ./runs/train/fog_02/weights/best.pt \\\n",
    "\"\"\"\n",
    "!{command}\n",
    "# --weights ./runs/train/exp3/weights/best.pt \\\n",
    "# 1.0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0b8b44c7-2d4c-4634-b905-975dd82328f3",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4ed9e846-19d7-45b2-b14b-91ad89d8cf25",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "324e93d7-a0e0-44ea-8c1b-73601c86a68d",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "8744e91a-21aa-432a-8e52-47510d8e0c82",
   "metadata": {},
   "outputs": [],
   "source": [
    "from EWC_module.fisher import cal_fisher\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "e372e073-b491-46ce-a402-284beca48e2e",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "                 from  n    params  module                                  arguments                     \n",
      "  0                -1  1      3520  models.common.Conv                      [3, 32, 6, 2, 2]              \n",
      "  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                \n",
      "  2                -1  1     18816  models.common.C3                        [64, 64, 1]                   \n",
      "  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               \n",
      "  4                -1  2    115712  models.common.C3                        [128, 128, 2]                 \n",
      "  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              \n",
      "  6                -1  3    625152  models.common.C3                        [256, 256, 3]                 \n",
      "  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              \n",
      "  8                -1  1   1182720  models.common.C3                        [512, 512, 1]                 \n",
      "  9                -1  1    656896  models.common.SPPF                      [512, 512, 5]                 \n",
      " 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              \n",
      " 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 12           [-1, 6]  1         0  models.common.Concat                    [1]                           \n",
      " 13                -1  1    361984  models.common.C3                        [512, 256, 1, False]          \n",
      " 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              \n",
      " 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 16           [-1, 4]  1         0  models.common.Concat                    [1]                           \n",
      " 17                -1  1     90880  models.common.C3                        [256, 128, 1, False]          \n",
      " 18                -1  1    147712  models.common.Conv                      [128, 128, 3, 2]              \n",
      " 19          [-1, 14]  1         0  models.common.Concat                    [1]                           \n",
      " 20                -1  1    296448  models.common.C3                        [256, 256, 1, False]          \n",
      " 21                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]              \n",
      " 22          [-1, 10]  1         0  models.common.Concat                    [1]                           \n",
      " 23                -1  1   1182720  models.common.C3                        [512, 512, 1, False]          \n",
      " 24      [17, 20, 23]  1     35061  models.yolo.Detect                      [8, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n",
      "YOLOv5s_kitti summary: 214 layers, 7041205 parameters, 7041205 gradients, 16.0 GFLOPs\n",
      "\n",
      "\u001b[34m\u001b[1mAMP: \u001b[0mchecks passed ✅\n",
      "\u001b[34m\u001b[1mAutoBatch: \u001b[0mComputing optimal batch size for --imgsz 640\n",
      "\u001b[34m\u001b[1mAutoBatch: \u001b[0mCUDA:0 (NVIDIA vGPU-32GB) 31.50G total, 0.22G reserved, 0.05G allocated, 31.23G free\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "      Params      GFLOPs  GPU_mem (GB)  forward (ms) backward (ms)                   input                  output\n",
      "     7041205       16.01         0.442         12.47         58.67        (1, 3, 640, 640)                    list\n",
      "     7041205       32.01         0.623         9.674         35.69        (2, 3, 640, 640)                    list\n",
      "     7041205       64.02         0.921         9.871         34.74        (4, 3, 640, 640)                    list\n",
      "     7041205         128         1.707         10.95         36.67        (8, 3, 640, 640)                    list\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mAutoBatch: \u001b[0mUsing batch-size 142 for CUDA:0 25.21G/31.50G (80%) ✅\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "     7041205       256.1         3.032         14.46         40.83       (16, 3, 640, 640)                    list\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1malbumentations: \u001b[0m1 validation error for InitSchema\n",
      "size\n",
      "  Field required [type=missing, input_value={'height': 640, 'width': ...'mask_interpolation': 0}, input_type=dict]\n",
      "    For further information visit https://errors.pydantic.dev/2.10/v/missing\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mScanning ../datasets/kitti/labels/train... 4189 images, 0 backgrounds, 0 corrupt: 100%|██████████| 4189/4189 [00:00<00:00, 6369.19it/s]\n",
      "\u001b[34m\u001b[1mtrain: \u001b[0mNew cache created: ../datasets/kitti/labels/train.cache\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fisher context saved at runs/train/fog_02/weights/fisher.pt\n"
     ]
    }
   ],
   "source": [
    "\n",
    "cal_fisher('runs/train/fog_02/weights/best.pt')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "65e11971-4820-4723-a111-1d3b38828497",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "ef5ddb28-4ecd-4364-95dc-10091203ced2",
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import torch\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "73930087-81c3-42d2-8bad-e65e45e5b43f",
   "metadata": {},
   "outputs": [],
   "source": [
    "fisher_c = torch.load('runs/train/fog_02/weights/fisher.pt')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "a1b4895c-2689-4b08-97a3-d3be32c80128",
   "metadata": {},
   "outputs": [],
   "source": [
    "fisher_values = torch.cat([f.view(-1) for f in fisher_c['fisher_matrix'].values()]).cpu().numpy()\n",
    "plt.clf()\n",
    "plt.hist(fisher_values, bins=100, log=True)\n",
    "plt.xlabel(\"Fisher Value\")\n",
    "plt.ylabel(\"Frequency (Log Scale)\")\n",
    "plt.title(\"Fisher Matrix Value Distribution\")\n",
    "\n",
    "plt.savefig('fisher_matrix_distribution.png', bbox_inches='tight')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "87679714-58ae-4f08-a99f-1bd728dfd877",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0aa6bf4f-356d-4044-ac38-fab96eb8d72f",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c54fb4b2-7f8b-4e31-bed3-4a915693d0cd",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "267c0415-2285-43f4-8a6d-2886aa27dee0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "tensor([[[[10.52134, 10.51013, 10.48123, 10.46381, 10.86565, 10.85219],\n",
      "          [10.49787, 10.48953, 10.45706, 10.43525, 10.82837, 10.80911],\n",
      "          [10.45231, 10.44555, 10.40911, 10.38052, 10.76508, 10.73916],\n",
      "          [10.37688, 10.36265, 10.31651, 10.28186, 10.65876, 10.63488],\n",
      "          [10.26770, 10.24430, 10.19352, 10.15908, 10.53925, 10.52574],\n",
      "          [10.19028, 10.16594, 10.11826, 10.08898, 10.47275, 10.46444]],\n",
      "\n",
      "         [[10.51521, 10.50735, 10.47907, 10.46242, 10.86493, 10.85210],\n",
      "          [10.49126, 10.48561, 10.45411, 10.43183, 10.82499, 10.80610],\n",
      "          [10.44986, 10.44652, 10.40982, 10.37999, 10.76343, 10.73730],\n",
      "          [10.38013, 10.36782, 10.32122, 10.28472, 10.66040, 10.63684],\n",
      "          [10.28175, 10.25943, 10.20769, 10.17092, 10.55084, 10.53820],\n",
      "          [10.21643, 10.19320, 10.14541, 10.11447, 10.49927, 10.49088]],\n",
      "\n",
      "         [[10.45528, 10.44911, 10.42404, 10.40865, 10.81279, 10.80158],\n",
      "          [10.42897, 10.42499, 10.39671, 10.37615, 10.77058, 10.75369],\n",
      "          [10.38995, 10.38899, 10.35513, 10.32660, 10.71029, 10.68695],\n",
      "          [10.32848, 10.31761, 10.27361, 10.23814, 10.61412, 10.59332],\n",
      "          [10.24289, 10.22106, 10.17196, 10.13638, 10.51696, 10.50713],\n",
      "          [10.19049, 10.16838, 10.12283, 10.09335, 10.47951, 10.47406]]],\n",
      "\n",
      "\n",
      "        [[[ 0.61731,  0.61357,  0.62874,  0.62151,  0.61868,  0.61626],\n",
      "          [ 0.61882,  0.61170,  0.62423,  0.61423,  0.60987,  0.60695],\n",
      "          [ 0.65213,  0.64243,  0.64960,  0.63481,  0.62848,  0.62556],\n",
      "          [ 0.66121,  0.65090,  0.65272,  0.63217,  0.62537,  0.62375],\n",
      "          [ 0.65816,  0.64973,  0.65374,  0.63332,  0.62556,  0.62307],\n",
      "          [ 0.64578,  0.63851,  0.64714,  0.63310,  0.62653,  0.62280]],\n",
      "\n",
      "         [[ 0.61954,  0.61552,  0.63089,  0.62374,  0.62036,  0.61822],\n",
      "          [ 0.62087,  0.61379,  0.62646,  0.61638,  0.61120,  0.60850],\n",
      "          [ 0.65428,  0.64457,  0.65228,  0.63716,  0.63000,  0.62732],\n",
      "          [ 0.66352,  0.65367,  0.65637,  0.63481,  0.62724,  0.62581],\n",
      "          [ 0.66030,  0.65266,  0.65747,  0.63614,  0.62809,  0.62566],\n",
      "          [ 0.64840,  0.64167,  0.65109,  0.63652,  0.62952,  0.62614]],\n",
      "\n",
      "         [[ 0.61847,  0.61465,  0.63041,  0.62356,  0.62041,  0.61829],\n",
      "          [ 0.61945,  0.61292,  0.62568,  0.61616,  0.61105,  0.60829],\n",
      "          [ 0.65325,  0.64371,  0.65201,  0.63725,  0.63026,  0.62780],\n",
      "          [ 0.66297,  0.65283,  0.65660,  0.63610,  0.62837,  0.62679],\n",
      "          [ 0.65995,  0.65159,  0.65718,  0.63722,  0.62977,  0.62743],\n",
      "          [ 0.64865,  0.64172,  0.65112,  0.63755,  0.63106,  0.62827]]],\n",
      "\n",
      "\n",
      "        [[[ 5.01533,  5.01263,  5.00268,  4.98001,  4.77458,  4.77023],\n",
      "          [ 4.96424,  4.96416,  4.95594,  4.93274,  4.72281,  4.71013],\n",
      "          [ 4.85663,  4.85121,  4.84178,  4.81492,  4.60614,  4.59820],\n",
      "          [ 4.69312,  4.66733,  4.64202,  4.61340,  4.42235,  4.43363],\n",
      "          [ 4.55302,  4.50749,  4.46730,  4.44185,  4.27111,  4.29911],\n",
      "          [ 4.51277,  4.47020,  4.43740,  4.41938,  4.25124,  4.27592]],\n",
      "\n",
      "         [[ 5.00329,  5.00097,  4.99163,  4.96891,  4.76219,  4.75847],\n",
      "          [ 4.95327,  4.95464,  4.94825,  4.92436,  4.71250,  4.69940],\n",
      "          [ 4.84115,  4.83771,  4.82848,  4.80172,  4.59115,  4.58425],\n",
      "          [ 4.67063,  4.64394,  4.61739,  4.58887,  4.39779,  4.41216],\n",
      "          [ 4.52392,  4.47732,  4.43479,  4.40994,  4.24037,  4.27204],\n",
      "          [ 4.48517,  4.44128,  4.40776,  4.38978,  4.22268,  4.24907]],\n",
      "\n",
      "         [[ 5.09110,  5.09133,  5.08421,  5.06216,  4.85165,  4.84530],\n",
      "          [ 5.03828,  5.04291,  5.03853,  5.01565,  4.79976,  4.78388],\n",
      "          [ 4.91946,  4.91746,  4.91076,  4.88396,  4.66955,  4.65955],\n",
      "          [ 4.73770,  4.71239,  4.68635,  4.65856,  4.46390,  4.47593],\n",
      "          [ 4.58021,  4.53377,  4.49230,  4.46692,  4.29462,  4.32429],\n",
      "          [ 4.53503,  4.49164,  4.45824,  4.44017,  4.27009,  4.29558]]],\n",
      "\n",
      "\n",
      "        ...,\n",
      "\n",
      "\n",
      "        [[[ 5.15414,  5.15025,  5.15760,  5.15870,  5.08074,  5.07002],\n",
      "          [ 5.17655,  5.17499,  5.18909,  5.19188,  5.10779,  5.09275],\n",
      "          [ 5.26010,  5.26943,  5.29387,  5.29861,  5.20316,  5.17538],\n",
      "          [ 5.26683,  5.28091,  5.31069,  5.31234,  5.21076,  5.17872],\n",
      "          [ 5.18828,  5.19370,  5.21292,  5.20877,  5.11126,  5.08799],\n",
      "          [ 5.10388,  5.10070,  5.10880,  5.09858,  5.01006,  4.99723]],\n",
      "\n",
      "         [[ 5.14843,  5.14153,  5.14793,  5.14915,  5.07270,  5.06366],\n",
      "          [ 5.17327,  5.17011,  5.18276,  5.18588,  5.10256,  5.08749],\n",
      "          [ 5.26389,  5.27265,  5.29711,  5.30198,  5.20596,  5.17644],\n",
      "          [ 5.27738,  5.29208,  5.32211,  5.32524,  5.22167,  5.18645],\n",
      "          [ 5.20437,  5.21011,  5.22847,  5.22470,  5.12581,  5.10002],\n",
      "          [ 5.12486,  5.12207,  5.12917,  5.11999,  5.02897,  5.01437]],\n",
      "\n",
      "         [[ 5.14159,  5.13477,  5.14093,  5.14268,  5.06776,  5.06102],\n",
      "          [ 5.17062,  5.16738,  5.17956,  5.18247,  5.10083,  5.08774],\n",
      "          [ 5.26701,  5.27664,  5.30085,  5.30515,  5.21175,  5.18324],\n",
      "          [ 5.28720,  5.30209,  5.33195,  5.33447,  5.23307,  5.19901],\n",
      "          [ 5.22054,  5.22695,  5.24562,  5.24148,  5.14533,  5.11913],\n",
      "          [ 5.14674,  5.14475,  5.15232,  5.14302,  5.05316,  5.03841]]],\n",
      "\n",
      "\n",
      "        [[[ 0.16715,  0.16431,  0.16130,  0.15862,  0.19821,  0.19727],\n",
      "          [ 0.16236,  0.15902,  0.15543,  0.15252,  0.19062,  0.18992],\n",
      "          [ 0.16047,  0.15646,  0.15226,  0.14897,  0.18668,  0.18651],\n",
      "          [ 0.15783,  0.15348,  0.14882,  0.14527,  0.18213,  0.18237],\n",
      "          [ 0.15623,  0.15205,  0.14751,  0.14412,  0.18058,  0.18080],\n",
      "          [ 0.15726,  0.15376,  0.14983,  0.14689,  0.18415,  0.18415]],\n",
      "\n",
      "         [[ 0.16772,  0.16489,  0.16182,  0.15918,  0.19883,  0.19794],\n",
      "          [ 0.16275,  0.15935,  0.15572,  0.15277,  0.19091,  0.19022],\n",
      "          [ 0.16072,  0.15662,  0.15234,  0.14901,  0.18669,  0.18656],\n",
      "          [ 0.15798,  0.15349,  0.14875,  0.14516,  0.18197,  0.18224],\n",
      "          [ 0.15641,  0.15217,  0.14755,  0.14414,  0.18058,  0.18087],\n",
      "          [ 0.15756,  0.15398,  0.15006,  0.14710,  0.18445,  0.18443]],\n",
      "\n",
      "         [[ 0.17146,  0.16873,  0.16573,  0.16315,  0.20364,  0.20270],\n",
      "          [ 0.16633,  0.16298,  0.15939,  0.15652,  0.19541,  0.19466],\n",
      "          [ 0.16411,  0.16006,  0.15581,  0.15244,  0.19085,  0.19062],\n",
      "          [ 0.16111,  0.15662,  0.15186,  0.14828,  0.18573,  0.18593],\n",
      "          [ 0.15943,  0.15519,  0.15057,  0.14713,  0.18417,  0.18439],\n",
      "          [ 0.16055,  0.15694,  0.15302,  0.15009,  0.18803,  0.18793]]],\n",
      "\n",
      "\n",
      "        [[[ 0.13009,  0.12639,  0.13770,  0.13310,  0.14168,  0.13830],\n",
      "          [ 0.12363,  0.12006,  0.12724,  0.11874,  0.12793,  0.12916],\n",
      "          [ 0.18705,  0.17847,  0.18021,  0.16858,  0.17989,  0.18563],\n",
      "          [ 0.18518,  0.17644,  0.18696,  0.18650,  0.19480,  0.19523],\n",
      "          [ 0.21294,  0.20980,  0.22803,  0.22422,  0.22863,  0.22326],\n",
      "          [ 0.25060,  0.24905,  0.26421,  0.25122,  0.25888,  0.25472]],\n",
      "\n",
      "         [[ 0.13156,  0.12823,  0.14029,  0.13750,  0.14717,  0.14584],\n",
      "          [ 0.12358,  0.12113,  0.12946,  0.12207,  0.13253,  0.13486],\n",
      "          [ 0.18465,  0.17827,  0.18239,  0.17196,  0.18506,  0.19342],\n",
      "          [ 0.17999,  0.17339,  0.18633,  0.18654,  0.19594,  0.19859],\n",
      "          [ 0.20333,  0.20152,  0.22076,  0.21837,  0.22535,  0.22447],\n",
      "          [ 0.23474,  0.23330,  0.25022,  0.24135,  0.25482,  0.25477]],\n",
      "\n",
      "         [[ 0.14015,  0.13634,  0.14817,  0.14439,  0.15238,  0.14990],\n",
      "          [ 0.12989,  0.12750,  0.13552,  0.12704,  0.13613,  0.13738],\n",
      "          [ 0.19207,  0.18599,  0.19001,  0.17740,  0.18782,  0.19425],\n",
      "          [ 0.18630,  0.17928,  0.19108,  0.18876,  0.19520,  0.19627],\n",
      "          [ 0.20638,  0.20391,  0.22050,  0.21524,  0.22068,  0.21919],\n",
      "          [ 0.23267,  0.23049,  0.24462,  0.23532,  0.24807,  0.24827]]]], device='cuda:0')\n"
     ]
    },
    {
     "ename": "NameError",
     "evalue": "name 'rbeak' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[6], line 3\u001b[0m\n\u001b[1;32m      1\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m name, value \u001b[38;5;129;01min\u001b[39;00m fisher_c[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfisher_matrix\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39mitems():\n\u001b[1;32m      2\u001b[0m     \u001b[38;5;28mprint\u001b[39m(value)\n\u001b[0;32m----> 3\u001b[0m     \u001b[43mrbeak\u001b[49m\n",
      "\u001b[0;31mNameError\u001b[0m: name 'rbeak' is not defined"
     ]
    }
   ],
   "source": [
    "for name, value in fisher_c['fisher_matrix'].items():\n",
    "    print(value)\n",
    "    rbeak\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8142d39f-95c8-4ef6-ade7-8e8000617f3c",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "29c6968b-fc62-4612-b59b-07b1de3850b2",
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "exp(): argument 'input' (position 1) must be Tensor, not dict",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m fisher_sharp \u001b[38;5;241m=\u001b[39m \u001b[43mtorch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexp\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfisher_c\u001b[49m\u001b[43m)\u001b[49m  \u001b[38;5;66;03m# 对 Fisher 矩阵进行指数操作\u001b[39;00m\n",
      "\u001b[0;31mTypeError\u001b[0m: exp(): argument 'input' (position 1) must be Tensor, not dict"
     ]
    }
   ],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ba9f7062-f4b4-480c-809c-f90a2adcf395",
   "metadata": {},
   "outputs": [],
   "source": [
    "from fog_test.for_different_strength import mix_dataset\n",
    "origin_ratio = {\n",
    "    '0.6':0,\n",
    "}\n",
    "# 先初始化数据集训练一个没有家务数据的\n",
    "mix_dataset(fogged_folder = '../datasets/fogged/', \n",
    "            ratio = origin_ratio,\n",
    "            train_folder = '../datasets/kitti/images/origin_train', \n",
    "            out_folder = '../datasets/kitti/images/train'\n",
    "               )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c7c7bb8c-db99-4fce-a9aa-2a8a3902d7ba",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "ce41820f-7281-4f88-b602-f5013cecce52",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\u001b[34m\u001b[1mval: \u001b[0mdata=data/kitti.yaml, weights=['runs/train/exp50/weights/best.pt'], batch_size=32, imgsz=640, conf_thres=0.001, iou_thres=0.6, max_det=300, task=test, device=, workers=8, single_cls=False, augment=False, verbose=False, save_txt=False, save_hybrid=False, save_conf=False, save_json=False, project=runs/val, name=exp, exist_ok=False, half=False, dnn=False\n",
      "YOLOv5 🚀 f4b7909c Python-3.10.8 torch-2.1.2+cu118 CUDA:0 (NVIDIA GeForce RTX 3080, 20181MiB)\n",
      "\n",
      "Fusing layers... \n",
      "YOLOv5s_kitti summary: 157 layers, 7031701 parameters, 0 gradients, 15.8 GFLOPs\n",
      "\u001b[34m\u001b[1mtest: \u001b[0mScanning /root/autodl-tmp/datasets/kitti/labels/test.cache... 2244 images,\u001b[0m\n",
      "                 Class     Images  Instances          P          R      mAP50   \n",
      "                   all       2244      12198      0.427       0.12      0.114     0.0545\n",
      "                   Car       2244       8711      0.837      0.383      0.548      0.285\n",
      "                   Van       2244        861      0.183      0.193     0.0878     0.0428\n",
      "                 Truck       2244        333      0.107      0.045     0.0222     0.0113\n",
      "                  Tram       2244        138          1          0    0.00217   0.000846\n",
      "            Pedestrian       2244       1286      0.288      0.342      0.228     0.0889\n",
      "        Person_sitting       2244         89          1          0    0.00796    0.00188\n",
      "               Cyclist       2244        496          0          0    0.00553    0.00166\n",
      "                  Misc       2244        284          0          0    0.00808    0.00371\n",
      "Speed: 0.0ms pre-process, 1.3ms inference, 0.9ms NMS per image at shape (32, 3, 640, 640)\n",
      "Results saved to \u001b[1mruns/val/exp79\u001b[0m\n",
      "Test set val successfully!\n"
     ]
    }
   ],
   "source": [
    "model = f'runs/train/exp50/weights/best.pt'\n",
    "\n",
    "val_command = f\" \\\n",
    "python val.py \\\n",
    "--data data/kitti.yaml \\\n",
    "--weights {model} \\\n",
    "--task test &&\\\n",
    "echo 'Test set val successfully!' \\\n",
    "\" \n",
    "!{val_command}\n",
    "\n",
    "# ewc强度0.5\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "07cb2279-9d29-4347-9682-364ae46fac58",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c955e9d8-9149-462e-b234-1e1d4b6f267e",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "71304b39-7b8e-4852-84ca-5528b28cb533",
   "metadata": {},
   "outputs": [],
   "source": [
    "import torch\n",
    "import os\n",
    "import cv2\n",
    "import yaml\n",
    "\n",
    "from models.yolo import Model\n",
    "from utils.general import (\n",
    "    LOGGER,\n",
    "    TQDM_BAR_FORMAT,\n",
    "    check_amp,\n",
    "    check_dataset,\n",
    "    check_file,\n",
    "    check_git_info,\n",
    "    check_git_status,\n",
    "    check_img_size,\n",
    "    check_requirements,\n",
    "    check_suffix,\n",
    "    check_yaml,\n",
    "    colorstr,\n",
    "    get_latest_run,\n",
    "    increment_path,\n",
    "    init_seeds,\n",
    "    intersect_dicts,\n",
    "    labels_to_class_weights,\n",
    "    labels_to_image_weights,\n",
    "    methods,\n",
    "    one_cycle,\n",
    "    print_args,\n",
    "    print_mutation,\n",
    "    strip_optimizer,\n",
    "    yaml_save,\n",
    ")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "9335b5e7-565b-4f95-8d4c-982c848aa133",
   "metadata": {},
   "outputs": [],
   "source": [
    "def get_fisher(weights = 'base_s_16e.pt'):\n",
    "    hyp = None\n",
    "    with open('data/hyps/hyp.scratch-low.yaml', errors=\"ignore\") as f:\n",
    "        hyp = yaml.safe_load(f)  # load hyps dict\n",
    "    \n",
    "    device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu') \n",
    "    \n",
    "    ckpt = torch.load(weights, map_location=\"cpu\")  # load checkpoint to CPU to avoid CUDA memory leak\n",
    "    model = Model(ckpt[\"model\"].yaml, ch=3, nc=8, anchors=hyp.get(\"anchors\")).to(device)  # create\n",
    "    \n",
    "    exclude = [\"anchor\"] if (hyp.get(\"anchors\")) and not resume else []  # exclude keys\n",
    "    csd = ckpt[\"model\"].float().state_dict()  # checkpoint state_dict as FP32\n",
    "    csd = intersect_dicts(csd, model.state_dict(), exclude=exclude)  # intersect\n",
    "    model.load_state_dict(csd, strict=False)  # load\n",
    "    #LOGGER.info(f\"Transferred {len(csd)}/{len(model.state_dict())} items from {weights}\")  # report\n",
    "\n",
    "\n",
    "    mean = {}\n",
    "    fisher_matrix  = {}\n",
    "    # 这里后面可能还得考虑一下冻结层要不要计算进入fisher的问题。\n",
    "    for name, param in model.model.named_parameters():\n",
    "        fisher_matrix [name] = torch.zeros_like(param)\n",
    "        mean[name] = param.data.clone()\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "447f491b-e949-44a3-8799-5fbb7e5a31ef",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\n",
      "                 from  n    params  module                                  arguments                     \n",
      "  0                -1  1      3520  models.common.Conv                      [3, 32, 6, 2, 2]              \n",
      "  1                -1  1     18560  models.common.Conv                      [32, 64, 3, 2]                \n",
      "  2                -1  1     18816  models.common.C3                        [64, 64, 1]                   \n",
      "  3                -1  1     73984  models.common.Conv                      [64, 128, 3, 2]               \n",
      "  4                -1  2    115712  models.common.C3                        [128, 128, 2]                 \n",
      "  5                -1  1    295424  models.common.Conv                      [128, 256, 3, 2]              \n",
      "  6                -1  3    625152  models.common.C3                        [256, 256, 3]                 \n",
      "  7                -1  1   1180672  models.common.Conv                      [256, 512, 3, 2]              \n",
      "  8                -1  1   1182720  models.common.C3                        [512, 512, 1]                 \n",
      "  9                -1  1    656896  models.common.SPPF                      [512, 512, 5]                 \n",
      " 10                -1  1    131584  models.common.Conv                      [512, 256, 1, 1]              \n",
      " 11                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 12           [-1, 6]  1         0  models.common.Concat                    [1]                           \n",
      " 13                -1  1    361984  models.common.C3                        [512, 256, 1, False]          \n",
      " 14                -1  1     33024  models.common.Conv                      [256, 128, 1, 1]              \n",
      " 15                -1  1         0  torch.nn.modules.upsampling.Upsample    [None, 2, 'nearest']          \n",
      " 16           [-1, 4]  1         0  models.common.Concat                    [1]                           \n",
      " 17                -1  1     90880  models.common.C3                        [256, 128, 1, False]          \n",
      " 18                -1  1    147712  models.common.Conv                      [128, 128, 3, 2]              \n",
      " 19          [-1, 14]  1         0  models.common.Concat                    [1]                           \n",
      " 20                -1  1    296448  models.common.C3                        [256, 256, 1, False]          \n",
      " 21                -1  1    590336  models.common.Conv                      [256, 256, 3, 2]              \n",
      " 22          [-1, 10]  1         0  models.common.Concat                    [1]                           \n",
      " 23                -1  1   1182720  models.common.C3                        [512, 512, 1, False]          \n",
      " 24      [17, 20, 23]  1     35061  models.yolo.Detect                      [8, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n",
      "Model summary: 214 layers, 7041205 parameters, 7041205 gradients, 16.0 GFLOPs\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.conv.weight\n",
      "0.bn.weight\n",
      "0.bn.bias\n",
      "1.conv.weight\n",
      "1.bn.weight\n",
      "1.bn.bias\n",
      "2.cv1.conv.weight\n",
      "2.cv1.bn.weight\n",
      "2.cv1.bn.bias\n",
      "2.cv2.conv.weight\n",
      "2.cv2.bn.weight\n",
      "2.cv2.bn.bias\n",
      "2.cv3.conv.weight\n",
      "2.cv3.bn.weight\n",
      "2.cv3.bn.bias\n",
      "2.m.0.cv1.conv.weight\n",
      "2.m.0.cv1.bn.weight\n",
      "2.m.0.cv1.bn.bias\n",
      "2.m.0.cv2.conv.weight\n",
      "2.m.0.cv2.bn.weight\n",
      "2.m.0.cv2.bn.bias\n",
      "3.conv.weight\n",
      "3.bn.weight\n",
      "3.bn.bias\n",
      "4.cv1.conv.weight\n",
      "4.cv1.bn.weight\n",
      "4.cv1.bn.bias\n",
      "4.cv2.conv.weight\n",
      "4.cv2.bn.weight\n",
      "4.cv2.bn.bias\n",
      "4.cv3.conv.weight\n",
      "4.cv3.bn.weight\n",
      "4.cv3.bn.bias\n",
      "4.m.0.cv1.conv.weight\n",
      "4.m.0.cv1.bn.weight\n",
      "4.m.0.cv1.bn.bias\n",
      "4.m.0.cv2.conv.weight\n",
      "4.m.0.cv2.bn.weight\n",
      "4.m.0.cv2.bn.bias\n",
      "4.m.1.cv1.conv.weight\n",
      "4.m.1.cv1.bn.weight\n",
      "4.m.1.cv1.bn.bias\n",
      "4.m.1.cv2.conv.weight\n",
      "4.m.1.cv2.bn.weight\n",
      "4.m.1.cv2.bn.bias\n",
      "5.conv.weight\n",
      "5.bn.weight\n",
      "5.bn.bias\n",
      "6.cv1.conv.weight\n",
      "6.cv1.bn.weight\n",
      "6.cv1.bn.bias\n",
      "6.cv2.conv.weight\n",
      "6.cv2.bn.weight\n",
      "6.cv2.bn.bias\n",
      "6.cv3.conv.weight\n",
      "6.cv3.bn.weight\n",
      "6.cv3.bn.bias\n",
      "6.m.0.cv1.conv.weight\n",
      "6.m.0.cv1.bn.weight\n",
      "6.m.0.cv1.bn.bias\n",
      "6.m.0.cv2.conv.weight\n",
      "6.m.0.cv2.bn.weight\n",
      "6.m.0.cv2.bn.bias\n",
      "6.m.1.cv1.conv.weight\n",
      "6.m.1.cv1.bn.weight\n",
      "6.m.1.cv1.bn.bias\n",
      "6.m.1.cv2.conv.weight\n",
      "6.m.1.cv2.bn.weight\n",
      "6.m.1.cv2.bn.bias\n",
      "6.m.2.cv1.conv.weight\n",
      "6.m.2.cv1.bn.weight\n",
      "6.m.2.cv1.bn.bias\n",
      "6.m.2.cv2.conv.weight\n",
      "6.m.2.cv2.bn.weight\n",
      "6.m.2.cv2.bn.bias\n",
      "7.conv.weight\n",
      "7.bn.weight\n",
      "7.bn.bias\n",
      "8.cv1.conv.weight\n",
      "8.cv1.bn.weight\n",
      "8.cv1.bn.bias\n",
      "8.cv2.conv.weight\n",
      "8.cv2.bn.weight\n",
      "8.cv2.bn.bias\n",
      "8.cv3.conv.weight\n",
      "8.cv3.bn.weight\n",
      "8.cv3.bn.bias\n",
      "8.m.0.cv1.conv.weight\n",
      "8.m.0.cv1.bn.weight\n",
      "8.m.0.cv1.bn.bias\n",
      "8.m.0.cv2.conv.weight\n",
      "8.m.0.cv2.bn.weight\n",
      "8.m.0.cv2.bn.bias\n",
      "9.cv1.conv.weight\n",
      "9.cv1.bn.weight\n",
      "9.cv1.bn.bias\n",
      "9.cv2.conv.weight\n",
      "9.cv2.bn.weight\n",
      "9.cv2.bn.bias\n",
      "10.conv.weight\n",
      "10.bn.weight\n",
      "10.bn.bias\n",
      "13.cv1.conv.weight\n",
      "13.cv1.bn.weight\n",
      "13.cv1.bn.bias\n",
      "13.cv2.conv.weight\n",
      "13.cv2.bn.weight\n",
      "13.cv2.bn.bias\n",
      "13.cv3.conv.weight\n",
      "13.cv3.bn.weight\n",
      "13.cv3.bn.bias\n",
      "13.m.0.cv1.conv.weight\n",
      "13.m.0.cv1.bn.weight\n",
      "13.m.0.cv1.bn.bias\n",
      "13.m.0.cv2.conv.weight\n",
      "13.m.0.cv2.bn.weight\n",
      "13.m.0.cv2.bn.bias\n",
      "14.conv.weight\n",
      "14.bn.weight\n",
      "14.bn.bias\n",
      "17.cv1.conv.weight\n",
      "17.cv1.bn.weight\n",
      "17.cv1.bn.bias\n",
      "17.cv2.conv.weight\n",
      "17.cv2.bn.weight\n",
      "17.cv2.bn.bias\n",
      "17.cv3.conv.weight\n",
      "17.cv3.bn.weight\n",
      "17.cv3.bn.bias\n",
      "17.m.0.cv1.conv.weight\n",
      "17.m.0.cv1.bn.weight\n",
      "17.m.0.cv1.bn.bias\n",
      "17.m.0.cv2.conv.weight\n",
      "17.m.0.cv2.bn.weight\n",
      "17.m.0.cv2.bn.bias\n",
      "18.conv.weight\n",
      "18.bn.weight\n",
      "18.bn.bias\n",
      "20.cv1.conv.weight\n",
      "20.cv1.bn.weight\n",
      "20.cv1.bn.bias\n",
      "20.cv2.conv.weight\n",
      "20.cv2.bn.weight\n",
      "20.cv2.bn.bias\n",
      "20.cv3.conv.weight\n",
      "20.cv3.bn.weight\n",
      "20.cv3.bn.bias\n",
      "20.m.0.cv1.conv.weight\n",
      "20.m.0.cv1.bn.weight\n",
      "20.m.0.cv1.bn.bias\n",
      "20.m.0.cv2.conv.weight\n",
      "20.m.0.cv2.bn.weight\n",
      "20.m.0.cv2.bn.bias\n",
      "21.conv.weight\n",
      "21.bn.weight\n",
      "21.bn.bias\n",
      "23.cv1.conv.weight\n",
      "23.cv1.bn.weight\n",
      "23.cv1.bn.bias\n",
      "23.cv2.conv.weight\n",
      "23.cv2.bn.weight\n",
      "23.cv2.bn.bias\n",
      "23.cv3.conv.weight\n",
      "23.cv3.bn.weight\n",
      "23.cv3.bn.bias\n",
      "23.m.0.cv1.conv.weight\n",
      "23.m.0.cv1.bn.weight\n",
      "23.m.0.cv1.bn.bias\n",
      "23.m.0.cv2.conv.weight\n",
      "23.m.0.cv2.bn.weight\n",
      "23.m.0.cv2.bn.bias\n",
      "24.m.0.weight\n",
      "24.m.0.bias\n",
      "24.m.1.weight\n",
      "24.m.1.bias\n",
      "24.m.2.weight\n",
      "24.m.2.bias\n"
     ]
    }
   ],
   "source": [
    "get_fisher()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "03276ffe-3af1-4c65-8005-f5698e8c5160",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5d61687c-1a93-432c-9b7f-ac782e6ddb6d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
